package org.gui.knnParamSelection;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Logger;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;


public class KnnParamsPanel extends JPanel implements ActionListener{
	
	private static final long serialVersionUID = 1L;
	private final static Logger logger = Logger.getLogger(""); 
	JComboBox<String> knnTypes;
	JComboBox<String> distanceMetrics;
	KSelection kSelection;
	DataProportionsPanel dataProportionPanel;
	JButton startButton;
	
	public KnnParamsPanel(){
	super();
	

	kSelection = new KSelection();
	add(kSelection);
	
	setLayout(new GridLayout(5,2,0,5));
	knnTypes = new JComboBox<String>();
	((JLabel)knnTypes.getRenderer()).setHorizontalAlignment(JLabel.CENTER);
	knnTypes.addItem("Classify using feature vector");
	knnTypes.addItem("Classify using similarity measure");
	add(knnTypes);

	distanceMetrics = new JComboBox<String>();
	((JLabel)distanceMetrics.getRenderer()).setHorizontalAlignment(JLabel.CENTER);
	distanceMetrics.addItem("Euclides");
	distanceMetrics.addItem("Czybyszew");
	distanceMetrics.addItem("Manhattan");
	add(distanceMetrics);

	dataProportionPanel = new DataProportionsPanel();
	add(dataProportionPanel);
	
	startButton = new JButton("Start computing...");
	add(startButton);
	}
	
	public int getKParameter(){
		return Integer.parseInt(kSelection.getkSelectionInput());
	}

	public String getMetric(){
		
		String selectedMetric = (String) distanceMetrics.getSelectedItem();
		
		return null;
	}
	
	public Double getTrainDataPercentage(){
		
		return dataProportionPanel.getDataProportionInput();
	}
	
	public String getknnType(){
		
		String selectedMetric = (String) knnTypes.getSelectedItem();
			
		return null;
	}

	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		
	}
	
}